#include <stdio.h>

int main()
{
    int x,y,count=0,j=0;
    int a[1418];
    scanf("%d%d",&x,&y);
    for (int i=x;i<=y;i++)
    {
        if((i%4==0&&i%100!=0)||(i%400==0))
        {
            count++;
            a[j]=i;
            j++;
        }
    }
    printf("%d\n",count);
    for (int i=0;i<count;i++)
    {
        printf("%d ",a[i]);
    }
    return 0;
}
